package com.ruoyi.develop.goodsSaledoGongxuUserLirun.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.develop.goodsSaledoGongxuUserLirun.domain.GoodsSaledoGongxuUserLirun;
import com.ruoyi.develop.goodsSaledoGongxuUserLirun.service.IGoodsSaledoGongxuUserLirunService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 报工算利润列Controller
 * @author lmm
 * @date 2025-06-27
 */
@RestController
@RequestMapping("/goodsSaledoGongxuUserLirun/goodsSaledoGongxuUserLirun")
public class GoodsSaledoGongxuUserLirunController extends BaseController {
    @Autowired
    private IGoodsSaledoGongxuUserLirunService goodsSaledoGongxuUserLirunService;

    /**
     * 查询报工算利润列列表
     */
    @PreAuthorize("@ss.hasPermi('develop:GoodsSaledoGongxuUserLirun:query')")
    @GetMapping("/list")
    public TableDataInfo list(GoodsSaledoGongxuUserLirun entity) {
        startPage();
        List<GoodsSaledoGongxuUserLirun> list = goodsSaledoGongxuUserLirunService.selectList(entity);
        return getDataTable(list);
    }

    /**
     * 导出报工算利润列列表
     */
    @PreAuthorize("@ss.hasPermi('develop:GoodsSaledoGongxuUserLirun:export')")
    @Log(title = "报工算利润列", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, GoodsSaledoGongxuUserLirun entity) {
        List<GoodsSaledoGongxuUserLirun> list = goodsSaledoGongxuUserLirunService.selectList(entity);
        ExcelUtil<GoodsSaledoGongxuUserLirun> util = new ExcelUtil<GoodsSaledoGongxuUserLirun>(GoodsSaledoGongxuUserLirun. class);
        util.exportExcel(response, list, "报工算利润列数据");
    }

    /**
     * 获取报工算利润列详细信息
     */
    @PreAuthorize("@ss.hasPermi('develop:GoodsSaledoGongxuUserLirun:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id) {
        return AjaxResult.success(goodsSaledoGongxuUserLirunService.selectById(id));
    }

    /**
     * 新增报工算利润列
     */
    @PreAuthorize("@ss.hasPermi('develop:GoodsSaledoGongxuUserLirun:add')")
    @Log(title = "报工算利润列", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody GoodsSaledoGongxuUserLirun entity) {
        return toAjax(goodsSaledoGongxuUserLirunService.insert(entity));
    }

    /**
     * 修改报工算利润列
     */
    @PreAuthorize("@ss.hasPermi('develop:GoodsSaledoGongxuUserLirun:edit')")
    @Log(title = "报工算利润列", businessType = BusinessType.UPDATE)
    @PutMapping("/edit")
    public AjaxResult edit(@RequestBody GoodsSaledoGongxuUserLirun entity) {
        return toAjax(goodsSaledoGongxuUserLirunService.update(entity));
    }

    /**
     * 删除报工算利润列
     */
    @PreAuthorize("@ss.hasPermi('develop:GoodsSaledoGongxuUserLirun:remove')")
    @Log(title = "报工算利润列", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids) {
        return toAjax(goodsSaledoGongxuUserLirunService.deleteByIds(ids));
    }
}
